package javase.ch01.homeWork;

import java.io.*;
import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入账号：");
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        System.out.println("请输入密码：");
        String pwd = sc.next();

        StringBuilder sb = new StringBuilder();
        StringBuilder np = sb.append(name).append("#").append(pwd);

        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("JavaSE\\emp.txt")));
        String line;
        while ((line = br.readLine()) != null) {
            boolean equals = line.equals(np.toString());
            if (equals) {
                System.out.println("登录成功");
                break;
            } else {
                System.out.println("登录失败");
            }
        }
    }
}
